<%--
  Created by IntelliJ IDEA.
  tip: lichengming
  Date: 2017/6/14
  Time: 下午4:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/resources.jsp" %>


<html>
<head>
    <title>数据列表</title>
</head>
<body>
<div>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">查询条件</h3>
        </div>
        <div class="panel-body">
            <form class="form-inline">
                <div class="form-group">
                    <%--<label for="searchCode">表名：</label>--%>
                    <input type="text" class="form-control" id="searchCode" name="search" placeholder="表名">
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-info btn-search">查询</button>
                    <button type="button" class="btn btn-default btn-reset">清空</button>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="ems_table_content">
    <div class="panel panel-default">
        <div class="panel-heading">数据库表列表</div>
        <div id="table_tools">
            <div class="form-inline" role="form">
            
            <button type="button"  class="btn btn-outline btn-primary">
             <a href="/starCms/table/getCode" style=" color:white">生成代码下载</a>
             </button>
             
              
               
                <button type="button" id="tip_create" class="btn btn-outline btn-primary">
                    <i class="glyphicon glyphicon-edit" aria-hidden="true"></i>
                    一键生成实体类
                </button>
            </div>
        </div>
        <table id="tipTable"
               data-url="/starCms/table/pagination"
               data-show-export="true">
            <thead>
            <tr>
                <th data-field="state" data-checkbox="true"></th>
                <th data-field="table_name"  >表名称</th>
            </tr>
            </thead>
        </table>
    </div>
</div>


<script>

    

    $(function () {
        $("#tipTable").createTable();


        //一键生成实体类
        $("#tip_create").on("click",function () {
        	var tableLists;
            var selectRows =  $('#tipTable').bootstrapTable('getSelections');
            var tableLists=JSON.stringify(selectRows);
            if (selectRows.length == 0) {
                $.errorAlert("请选择要生成的数据表");
                return;
            }
            $.confirmAlert("你确定要生成勾选表格的实体类吗？",function(){
                $.emsAjax({
                    data:{tableLists:tableLists},
                    type:"POST",
                    url:"/starCms/table/createTable",
                    success:function(resp) {
                        if (resp.status == "000") {
                            $.alert("生成成功");
                            search("#qgTable",getQueryParams());
                        }else {
                            $.errorAlert(resp.message);
                        }
                    }
                });
            });

        })

      

        //搜索
        $(".btn-search").on("click",function () {
            search(getQueryParams());
        });

        //重置
        $(".btn-reset").on("click",function () {
            $("#queryForm").find("input,select").each(function (index,val) {
                $(val).val("");
            });
        });
    })
</script>
<div id="tip_add_dialog"></div>
</body>
</html>
